package com.yuedao.sender.model1;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * AssistDemo
 * com.chris.demo.model.orm
 * Created by Chris Chen
 * 2018/1/5
 * Explain:
 */
@Entity(name = "ydx_user_balances")
public class UserBalanceEntity {
    private int id;
    private double balance;
    private Integer clearable;
    private Integer closed;
    private Timestamp balanceMonth;
    private String description;
    private int orderId;
    private Integer userId;
    private Integer franchiseeId;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "balance", nullable = false, precision = 2)
    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Basic
    @Column(name = "clearable", nullable = true)
    public Integer getClearable() {
        return clearable;
    }

    public void setClearable(Integer clearable) {
        this.clearable = clearable;
    }

    @Basic
    @Column(name = "closed", nullable = true)
    public Integer getClosed() {
        return closed;
    }

    public void setClosed(Integer closed) {
        this.closed = closed;
    }

    @Basic
    @Column(name = "balance_month", nullable = false)
    public Timestamp getBalanceMonth() {
        return balanceMonth;
    }

    public void setBalanceMonth(Timestamp balanceMonth) {
        this.balanceMonth = balanceMonth;
    }

    @Basic
    @Column(name = "description", nullable = true, length = 2048)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Basic
    @Column(name = "order_id", nullable = false)
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "user_id", nullable = true)
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "franchisee_id", nullable = true)
    public Integer getFranchiseeId() {
        return franchiseeId;
    }

    public void setFranchiseeId(Integer franchiseeId) {
        this.franchiseeId = franchiseeId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserBalanceEntity that = (UserBalanceEntity) o;

        if (id != that.id) return false;
        if (Double.compare(that.balance, balance) != 0) return false;
        if (orderId != that.orderId) return false;
        if (clearable != null ? !clearable.equals(that.clearable) : that.clearable != null) return false;
        if (closed != null ? !closed.equals(that.closed) : that.closed != null) return false;
        if (balanceMonth != null ? !balanceMonth.equals(that.balanceMonth) : that.balanceMonth != null) return false;
        if (description != null ? !description.equals(that.description) : that.description != null) return false;
        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        if (franchiseeId != null ? !franchiseeId.equals(that.franchiseeId) : that.franchiseeId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = id;
        temp = Double.doubleToLongBits(balance);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (clearable != null ? clearable.hashCode() : 0);
        result = 31 * result + (closed != null ? closed.hashCode() : 0);
        result = 31 * result + (balanceMonth != null ? balanceMonth.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + orderId;
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (franchiseeId != null ? franchiseeId.hashCode() : 0);
        return result;
    }
}
